/*********************\
* Author:Dzlua
* QQ:505544956
* Time:2017/04/11
\**********************/
#include "LuaBase.h"

#define SDLUA_KEY_DECLARE(obj, name, value) (obj.SetInteger(#name, value))
#define SDLUA_KEY_UNDECLARE(obj, name) (obj.SetNil(#name))

namespace DuiLib {
namespace LuaBase {

void RegWndStyle(LuaObject &obj)
{
    SDLUA_KEY_DECLARE(obj, ED_FRAME, UI_WNDSTYLE_FRAME);
    SDLUA_KEY_DECLARE(obj, ED_CHILD, UI_WNDSTYLE_CHILD);
    SDLUA_KEY_DECLARE(obj, ED_DIALOG, UI_WNDSTYLE_DIALOG);

    SDLUA_KEY_DECLARE(obj, ED_EX_FRAME, UI_WNDSTYLE_EX_FRAME);
    SDLUA_KEY_DECLARE(obj, ED_EX_DIALOG, UI_WNDSTYLE_EX_DIALOG);

    SDLUA_KEY_DECLARE(obj, ED_EX_TOPMOST, WS_EX_TOPMOST);
    SDLUA_KEY_DECLARE(obj, ED_EX_TOOLTIP, WS_EX_TOOLWINDOW);
}

void UnRegWndStyle(LuaObject &obj)
{
    SDLUA_KEY_UNDECLARE(obj, ED_FRAME);
    SDLUA_KEY_UNDECLARE(obj, ED_CHILD);
    SDLUA_KEY_UNDECLARE(obj, ED_DIALOG);
    
    SDLUA_KEY_UNDECLARE(obj, ED_EX_FRAME);
    SDLUA_KEY_UNDECLARE(obj, ED_EX_DIALOG);

    SDLUA_KEY_UNDECLARE(obj, ED_EX_TOPMOST);
    SDLUA_KEY_UNDECLARE(obj, ED_EX_TOOLTIP);
}

//---------------------------------//
void RegisterDefine(LuaState* L)
{
    LuaObject def = L->GetGlobals();
    RegWndStyle(def);
}

void UnRegisterDefine(LuaState* L)
{
    LuaObject def = L->GetGlobals();
    UnRegWndStyle(def);
}

}
}

#undef SDLUA_KEY_DECLARE
#undef SDLUA_KEY_UNDECLARE